#ifndef POINTERS_H_
#define POINTERS_H_

#include <stdlib.h>
#include <stdint.h>

#define INVALID_OFFSET		((uint32_t)-1)

static inline void *ptradd(void *ptr, uint32_t offset)
{
	return offset == INVALID_OFFSET ? NULL : ptr + offset;
}

static inline uint32_t ptrsub(void *ptr1, void *ptr2)
{
	return ptr1 == NULL ? INVALID_OFFSET : ptr1 - ptr2;
}

#endif /* POINTERS_H_ */
